﻿using Reactor.Messages.Events.Adoptions;
using Reactor.Messaging;
using Reactor.Messaging.Attributes;

namespace Reactor.CoreHost.Handlers
{
    [PointToPointChannel]
    public class ServiceAdoptedEventHandler : MessageHandlerBase<ServiceAdopted>
    {
        #region Overrides of MessageHandlerBase<ServiceAdopted>

        public override void OnHandling(ServiceAdopted message, IMessageContext messageContext)
        {
            AssertThatCurrentServiceIsAReactorCore();

            var core = GetCurrentServiceAsReactorCore();
            core.ResumeServiceTransfer(message, messageContext.WorkflowInstanceId);
        }

        #endregion
    }
}
